// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** 获取当前的用户 GET /api/currentUser */
export async function currentUser(options?: { [key: string]: any }) {
  return request<{
    data: API.CurrentUser;
  }>('/corpus/ykz/zwdd/getUserInfo', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 退出登录接口 POST /api/login/outLogin */
export async function outLogin(options?: { [key: string]: any }) {
  return request<Record<string, any>>('/corpus/ykz/zwdd/logout', {
    method: 'get',
    ...(options || {}),
  });
}
export async function loginByAuthCode(body: any, options?: { [key: string]: any }) {
  return request<API.LoginResult>('/corpus/ykz/zwdd/login', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
/** 登录接口 POST /api/login/account */
export async function login(
  body: { code: string; loginMode: string },
  options?: { [key: string]: any },
) {
  return request<API.LoginResult>('/corpus/ykz/zwdd/login', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 GET /api/notices */
export async function getNotices(options?: { [key: string]: any }) {
  return request<API.NoticeIconList>('/api/notices', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 获取规则列表 GET /api/rule */
export async function getFileLowType(
  params: {
    // query
    /** 当前的页码 */
    current?: number;
    /** 页面的容量 */
    pageSize?: number;
  },
  options?: { [key: string]: any },
) {
  return request<API.RuleList>('/corpus/getList', {
    method: 'POST',
    data: params,
    ...(options || {}),
  });
}
export async function getDimList(
  params: {
    // query
    /** 当前的页码 */
    current?: number;
    /** 页面的容量 */
    pageSize?: number;
  },
  options?: { [key: string]: any },
) {
  return request<API.RuleList>('/corpus/getDimList ', {
    method: 'POST',
    data: params,
    ...(options || {}),
  });
}
/** 更新规则 PUT /api/rule */
export async function updateRule(options?: { [key: string]: any }) {
  return request<API.RuleListItem>('/api/rule', {
    method: 'POST',
    data: {
      method: 'update',
      ...(options || {}),
    },
  });
}

export async function changeDept(params: { deptCode: string }, options?: { [key: string]: any }) {
  return request<API.CurrentUser>(`/corpus/ykz/zwdd/defaultDept`, {
    method: 'get',
    params: params,
  });
}
export async function getFile(yklRel: any) {
  return request<API.RuleListItem>(`/corpus/downloadFile?yklRel=${yklRel}`, {
    method: 'GET',
    data: {
      method: 'post',
    },
    responseType: 'blob',
  });
}
export async function defaultRole(params: { roleId: string }, options?: { [key: string]: any }) {
  return request<API.CurrentUser>(`/corpus/ykz/zwdd/defaultRole`, {
    method: 'get',
    params: params,
  });
}
export async function removeRule(options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/rule', {
    method: 'POST',
    data: {
      method: 'delete',
      ...(options || {}),
    },
  });
}
export async function getCount(options?: { [key: string]: any }) {
  return request<API.RuleListItem>('/corpus/getVJcylkClnFileCount', {
    method: 'get',
    data: {
      method: 'get',
      ...(options || {}),
    },
  });
}

export async function getYlkDataListContent(options?: { [key: string]: any }) {
  return request<API.RuleList>('/corpus/getYlkDataList ', {
    method: 'get',
    ...(options || {}),
  });
}
/**
 * 获取语料库列表
 * @param params
 * @param options
 * @returns
 */
export async function getYuliaoList(
  params: {
    // query
    /** 当前的页码 */
    current?: number;
    /** 页面的容量 */
    pageSize?: number;
  },
  options?: { [key: string]: any },
) {
  return request<any>('/corpus/yuliao/getList   ', {
    method: 'post',
    data: params,
    ...(options || {}),
  });
}

/**
 * 拆分语料库
 * @param params
 * @param options
 * @returns
 */
export async function getFileJson(params: { fileId: string }, options?: { [key: string]: any }) {
  return request<API.RuleList>(`/corpus/yuliao/getFileJson?fileId=${params.fileId}`, {
    method: 'get',
    ...(options || {}),
  });
}
